package cn.itheima.student.utils;
import javax.sql.DataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.mysql.jdbc.Connection;

public class JDBCUtils {
	/**
	 * 连接池 连接 mysql
	 * @anther : 李健
	 */
	
	//1.提供c3p0数据源对象
	private static ComboPooledDataSource cd = new ComboPooledDataSource();
	
	
	//2.提供方法，返回连接池对象
	public static DataSource getDataSource(){
		return cd;
	}
	
	//3.提供方法：获取链接对象
	public static Connection getCon() throws Exception {
		return (Connection) cd.getConnection();
	}
}
